package com.gklyj.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Controller
public class MyMVCconfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(myInterceptor)
                .addPathPatterns("/qiuzhi/**")
                .excludePathPatterns("/login/login.html");
    }

    @Override
    public void addViewControllers(ViewControllerRegistry registry){
        registry.addViewController("/tologin").setViewName("login/login");
        registry.addViewController("/login.html").setViewName("login/login");
    }
}
